package com.example.firstapplication;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class phoneActivity extends Activity {
	private EditText edit_PhoneNumber;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		edit_PhoneNumber = (EditText) this.findViewById(R.id.edit_PhoneNumber);
		Button button = (Button) this.findViewById(R.id.Button);
		button.setOnClickListener(new ButtonOnClickListener());
	}

	private final class ButtonOnClickListener implements View.OnClickListener {

		@Override
		public void onClick(View v) {
			String phoneNumber = edit_PhoneNumber.getText().toString();
			Intent intent = new Intent();
			intent.setAction(Intent.ACTION_CALL);
			intent.addCategory(Intent.CATEGORY_DEFAULT);
			intent.setData(Uri.parse("tel:" + phoneNumber));
			startActivity(intent);

		}

	}

}
